import Vue from 'vue'
import VueRouter from 'vue-router'
// import home from '../views/Home.vue、'
import bue from '../components/bue.vue'
import page from '../components/page.vue'
import index from '../views/index.vue'
import buechildren1 from '../components/buechildren/buechildren1.vue'
import buechildren2 from '../components/buechildren/buechildren2.vue'
import buechildren3 from '../components/buechildren/buechildren3.vue'
import shiyan from '../views/shiyan.vue'
import detlete from '../views/detlete'
import datailc from '../views/datailc'

// import childrens from '../components/vues.js'
Vue.use(VueRouter)

const routes = [{
        path: '/shiyan',
        component: shiyan,
        title: '实验'
    },
    {
        path: '/index',
        name: 'index',
        component: index,
        title: '項目已',
        redirect: '/index/page/detlete',
        children: [
            // ...childrens
            {
                path: 'bue',
                component: bue,
                title: '这是bue',
                children: [{
                        path: '/index/bue/buechildren1',
                        name: "buechildren1",
                        component: buechildren1,
                        title: '这是buechildren1'
                    }, {
                        path: '/index/bue/buechildren2',
                        name: "buechildren2",
                        component: buechildren2,
                        title: '这是buechildren2'
                    }, {
                        path: '/index/bue/buechildren3',
                        name: "buechildren3",
                        component: buechildren3,
                        title: '这是buechildren3'
                    }

                ]
            },
            {
                path: 'page',
                component: page,
                title: '这是page',
                children: [
                    {
                        path: '/index/page/detlete',
                        name: "detlete",
                        component: detlete,
                        title: 'detlete'
                    },
                    {
                        path: '/index/page/detlete/datailc',
                        name: "datailc",
                        component: datailc,
                        title: 'datailc'
                    }
                ]
            }
        ]

    },
    // {
    //   path: '/home',
    //   name: 'home',
    //   title: '项目1',
    //   component: home,

    // },
    {
        path: '/about',
        name: 'About',
        component: () =>
            import ( /* webpackChunkName: "about" */ '../views/About.vue')
    }
]
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err);
};
const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router